from w2v_tools import *
import numpy as np


class DataLoader:

    def __init__(self, file):
        """
        :param file: file path of vec
        """
        self.path = file
        self.word, self.vec = self.__read_vec()

    def __read_vec(self):
        """
        :return: words, pretrained_embedded_table -> shape (word_num, dim)
        """
        return read_glove_vecs(self.path)

    def get_word(self):
        return self.word

    def get_vec(self):
        return self.vec

    def save_word(self):
        np.save('./data/word.npy', self.word)

    def load_word(self):
        return np.load('./data/word.npy')


if __name__ == '__main__':
    dataLoader = DataLoader(r'./data/glove.6B.300d.txt')
    dataLoader.save_word()
